﻿<UserControl x:Class="ApiScannerShell.Views.ExchangeStoreScannerTestConfigurationElementEditView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ApiScannerShell="clr-namespace:ApiScannerShell" xmlns:ViewModels="clr-namespace:ApiScannerShell.ViewModels">
    <Grid>
        <Grid.Resources>
            <ApiScannerShell:InvertBoolConverter x:Key="InvertBoolConverter" />
            <DataTemplate DataType="{x:Type ViewModels:ServerNameConfigurationElementViewModel}">
                <TextBlock Style="{StaticResource ListBoxText}" Text="{Binding Name}" />
            </DataTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" SharedSizeGroup="Header" />
            <ColumnDefinition Width="*" SharedSizeGroup="Settings" />
        </Grid.ColumnDefinitions>
        <TextBlock Style="{StaticResource Text}" Grid.Row="0" Grid.Column="0" Text="Domain:" />
        <TextBlock Style="{StaticResource Text}" Grid.Row="1" Grid.Column="0" Text="Scan mailbox folders:" />
        <TextBlock Style="{StaticResource Text}" Grid.Row="2" Grid.Column="0" Text="Scan public folders:" />
        <TextBlock Style="{StaticResource Text}" Grid.Row="3" Grid.Column="0" Text="Server to scan:" />
        <TextBox Style="{StaticResource TextBox}" Grid.Row="0" Grid.Column="1" Text="{Binding Domain}" />
        <WrapPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
            <RadioButton Style="{StaticResource RadioButton}" Content="Enabled" IsChecked="{Binding ScanPrivateFolders}" />
            <RadioButton Style="{StaticResource RadioButton}" Content="Disabled" IsChecked="{Binding ScanPrivateFolders, Converter={StaticResource InvertBoolConverter}}" />
        </WrapPanel>
        <WrapPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="1">
            <RadioButton Style="{StaticResource RadioButton}" Content="Enabled" IsChecked="{Binding ScanPublicFolders}" />
            <RadioButton Style="{StaticResource RadioButton}" Content="Disabled" IsChecked="{Binding ScanPublicFolders, Converter={StaticResource InvertBoolConverter}}" />
        </WrapPanel>
        <RadioButton Style="{StaticResource RadioButton}" Grid.Row="3" Grid.Column="1" Content="Scan all servers" GroupName="ScanAllServers" IsChecked="{Binding ScanAllServers}" />
        <WrapPanel Orientation="Vertical" Grid.Row="4" Grid.Column="1">
            <RadioButton Style="{StaticResource RadioButton}" Content="Scan these servers:" GroupName="ScanAllServers" IsChecked="{Binding ScanAllServers, Converter={StaticResource InvertBoolConverter}}" />
            <DockPanel IsEnabled="{Binding ScanAllServers, Converter={StaticResource InvertBoolConverter}}">
                <Button Style="{StaticResource Button}" Content="Add" DockPanel.Dock="Right" Command="{Binding AddServerCommand}" CommandParameter="{Binding Text, ElementName=ServerName}" />
                <TextBlock Style="{StaticResource Text}" DockPanel.Dock="Left" Text="Server name:" />
                <TextBox Style="{StaticResource TextBox}" x:Name="ServerName" Width="200" />
            </DockPanel>
        </WrapPanel>
        <ListBox Style="{StaticResource ListBox}" Grid.Column="1" Grid.Row="5" ItemsSource="{Binding Servers}" x:Name="ServerNames" IsEnabled="{Binding ScanAllServers, Converter={StaticResource InvertBoolConverter}}" SelectionMode="Extended" />
        <TextBlock Style="{StaticResource Text}" Grid.Row="6" Grid.Column="1">
						<Hyperlink Command="{Binding RemoveServerNameCommand}" CommandParameter="{Binding SelectedItems, ElementName=ServerNames}">
							<Run Text="Remove selected entries" />
						</Hyperlink>
        </TextBlock>
    </Grid>
</UserControl>
